package com.fjb.service.help.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fjb.common.entity.HttpCode;
import com.fjb.common.entity.JsonPagesResult;
import com.fjb.common.entity.PageQuery;
import com.fjb.mapper.help.SysHelpInfoMapper;
import com.fjb.pojo.help.SysHelpInfo;
import com.fjb.service.help.SysHelpInfoService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

/**
 * <p>
 * 帮助中心 服务实现类
 * </p>
 *
 * @author hemiao
 * @since 2020-02-25
 */
@Service
public class SysHelpInfoServiceImpl extends ServiceImpl<SysHelpInfoMapper, SysHelpInfo> implements SysHelpInfoService {
	
	@Autowired
	private SysHelpInfoMapper sysHelpInfoMapper;
	
	@Override
	public JsonPagesResult<List<SysHelpInfo>> selectPageList(PageQuery pageQuery) {
		PageHelper.startPage(pageQuery.getCurrentPage(), pageQuery.getPageSize());
		QueryWrapper<SysHelpInfo> queryWrapper = new QueryWrapper<SysHelpInfo>();
		queryWrapper.eq("help_status", 1);
		List<SysHelpInfo> infoList = sysHelpInfoMapper.selectList(queryWrapper);
		PageInfo<SysHelpInfo> pageInfo = new PageInfo<SysHelpInfo>(infoList);	
		return new JsonPagesResult<List<SysHelpInfo>>(infoList, HttpCode.SUCCESS, pageInfo.getTotal(),pageInfo.getPages());
	}

}
